package client.controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFileChooser;

public class B_browseFolderController extends AbstractController implements ActionListener {

	private JFileChooser _fileChooser;
	
	public B_browseFolderController(MainController mc)
	{
		super(mc);
		_fileChooser = new JFileChooser();
		_fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
	}

	@Override
	public boolean isValid()
	{
		return true;
	}

	@Override
	public void actionPerformed(ActionEvent arg0)
	{
		if (_fileChooser.showOpenDialog(getMainWindow()) == JFileChooser.APPROVE_OPTION)
		{
			getMainWindow().get_clientExplorer().setDirectory(_fileChooser.getSelectedFile().getAbsolutePath());
		}
	}

}
